import request from '@/utils/request'
import { rsaEncrypt } from '@/utils/commonUtil3'

// H5后台接口
// 获取轮播图
export function getBannerList(data) {
  return request({
    url: '/carousel/select',
    method: 'get',
    params: data
  })
}

// 添加轮播图
export function addBanner(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/carousel/insert',
    method: 'post',
    data: {
      data: data1
    }
  })
}

// 删除轮播图
export function deleteBanner(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/carousel/delete',
    method: 'delete',
    data: {
      data: data1
    }
  })
}

// 修改轮播图
export function updateBanner(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/carousel/update',
    method: 'put',
    data: {
      data: data1
    }
  })
}

// 根据id获取轮播图
export function getBannerById(data) {
  return request({
    url: '/carousel/selectById',
    method: 'get',
    params: data
  })
}

// 消息
// 获取消息列表
export function getMsgList(data) {
  return request({
    url: '/message/select',
    method: 'get',
    params: data
  })
}

// 新增消息
export function addMsg(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/message/insert',
    method: 'post',
    data: {
      data: data1
    }
  })
}

// 修改消息
export function updateMsg(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/message/update',
    method: 'put',
    data: {
      data: data1
    }
  })
}

// 删除消息
export function deleteMsg(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/message/delete',
    method: 'delete',
    data: {
      data: data1
    }
  })
}

// 扶农商品
// 获取扶农商品列表
export function getFarmingGoodsList(data) {
  return request({
    url: '/farmerCommodity/select',
    method: 'get',
    params: data
  })
}

// 修改扶农商品
export function updateFarmingGoods(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/farmerCommodity/update',
    method: 'put',
    data: {
      data: data1
    }
  })
}
// 新增扶农商品
export function addFarmingGoods(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/farmerCommodity/insert',
    method: 'post',
    data: {
      data: data1
    }
  })
}

// 删除扶农商品
export function delFarmingGoods(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/farmerCommodity/delete',
    method: 'delete',
    data: {
      data: data1
    }
  })
}

// 通证走势
// 获取通证走势列表
export function getStockList(data) {
  return request({
    url: '/tokenRule/select',
    method: 'get',
    params: data
  })
}

// 添加通证走势
export function addStock(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/tokenRule/insert',
    method: 'post',
    data: {
      data: data1
    }
  })
}

// 修改通证走势
export function updateStock(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/tokenRule/update',
    method: 'put',
    data: {
      data: data1
    }
  })
}

// 删除通证走势
export function delStock(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/tokenRule/delete',
    method: 'delete',
    data: {
      data: data1
    }
  })
}

// 控制通证提现模块显示
export function controlWithdraw(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/sysSetting/updateSysSetting',
    method: 'put',
    data: {
      data: data1
    }
  })
}
// 获取通证提现模块显示
export function getWithdraw(data) {
  return request({
    url: '/sysSetting/selectSysSettingByKey',
    method: 'get',
    params: {
      code: 'MEMBER_CASH_STATUS'
    }
  })
}

// 获取协议
export function getAgreement(data) {
  return request({
    url: '/sysDynamicText/selectSysSettingByKey',
    method: 'get',
    params: {
      textKey: 'AGREEMENT'
    }
  })
}

// 修改协议
export function updateAgreement(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/sysDynamicText/updateSysDynamicText',
    method: 'put',
    data: {
      data: data1
    }
  })
}

// 获取app列表
export function getAppList(data) {
  return request({
    url: '/updatePackage/select',
    method: 'get',
    params: data
  })
}

// 添加app包
export function addApp(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/updatePackage/insert',
    method: 'post',
    data: {
      data: data1
    }
  })
}

// 删除app包
export function delApp(data) {
  const data1 = rsaEncrypt(data)
  return request({
    url: '/updatePackage/delete',
    method: 'delete',
    data: {
      data: data1
    }
  })
}
